﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    仓库巡检管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            仓库巡检管理
        </div>
        <div class="options">
        </div>
    </div>
    <%--  <table width="100%">
        <tr>
            <td class="adminTitle">
                <img alt="仓库名称" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="仓库名称"></img><label
                    for="operationName" title="仓库名称">仓库名称</label>:
            </td>
            <td class="adminData">
           
    <%Html.RenderAction("GetWarehouseList", "Warehouse", new { area = "WarehouseInsp", ctrAttr = new Microhard.WebUI.Models.AttriubteOfSelectList { ParameterModelName = "SelectedWarehouseID", IsMulitiplySelect = false, DefaultSelectedText = "请选择", DefaultSelectedValue = Guid.Empty.ToString() } });%>
    </td> </tr> </table>--%>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Microhard.WarehouseInsp.Buz.Models.InspectionRecordModel>((List<Microhard.WarehouseInsp.Buz.Models.InspectionRecordModel>)this.Model.Data)
                    .Name("operation-grid")
                    .ToolBar(t => t.Template(g =>
                    { %>
                <%var searchParms = new Dictionary<string, string>();
                  searchParms.Add("WarehouseID", "SelectedWarehouseID");
                %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <%--  <li class="t-item  t-state-default">
                            <%=Html.Authorized_SearchButton("btnSearch", "查询", "operation-grid", searchParms, "OperationGridOnGridDataBinding")%>
                        </li>--%>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "InspectionRecord")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "修改", "operation-grid", "Update", "InspectionRecord", "WarehouseInsp")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "operation-grid", "Delete", "InspectionRecord", "WarehouseInsp")%>
                        </li>
                    </ul>
                </div>
                <%}))
                      //.ClientEvents(events => events.OnDataBinding("OperationGridOnGridDataBinding"))
                         .Columns(columns =>
                         {
                             columns.Bound(x => x.InspectionRecordID)
                            .Template(x => Html.CheckBox("checkedRecords", new { value = x.InspectionRecordID, @class = "gridCks" }))
                            .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= InspectionRecordID #>' class='gridCks'/>")
                          .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                             columns.Bound(x => x.WarehouseName).Title("仓库名称");
                             columns.Bound(x => x.InsEmployeeName).Title("驻仓监管员");
                             columns.Bound(x => x.InsEmployeePhone).Title("驻仓监管员电话");
                             columns.Bound(x => x.InsDatetime).Title("巡查日期");
                             columns.Bound(x => x.PledePrdDescription).Title("监管物情况");
                             columns.Bound(x => x.CurrentAmountInSheet).Title("当日帐面货值");
                             columns.Bound(x => x.CurrentAmountIByChecking).Title(" 当日实盘货值");
                             columns.Bound(x => x.FileList).Title("文件")
                          .ClientTemplate("<#= showfileLinks(FileList) #>");

                         })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                      //绑定搜索按钮，执行对应的action
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "InspectionRecord"))
                    .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function showfileLinks(e) {
            var all = "";
            var baseUrl = '<%=Url.Action("Download","Upload")%>';
            for (var f = 0; f < e.length; f++) {
                var url = baseUrl + "?fileid=" + e[f].AttachmentID;
                all = all + '<a href="' + url + '">' + e[f].Name + "</a></br>";
            }
            return all;
        }
    </script>
</asp:Content>
